package com.dsg.controller.account;


import com.dsg.common.constants.MessageConstants;
import com.dsg.common.dto.AjaxResult;
import com.dsg.common.util.toolbox.StringUtil;
import com.dsg.controller.base.BaseController;
import com.dsg.entity.account.DsgAccountCash;
import com.dsg.service.account.IDsgAccountCashService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 油公司日結帳 前端控制器
 * </p>
 *
 * @author system
 * @since 2020-07-12
 */
@RestController
@RequestMapping("/account/dsgAccountCash")
@Api(description = "油公司日結帳")
public class DsgAccountCashController extends BaseController {

    @Autowired
    private IDsgAccountCashService dsgAccountCashService;

    /**
     * 對賬
     *
     * @param dsgAccountCash
     * @return
     */
    @PutMapping(value = "/reconciliation")
    @ApiOperation("對賬")
    public AjaxResult reconciliation(@RequestBody DsgAccountCash dsgAccountCash) {
        if (StringUtil.isEmpty(dsgAccountCash.getOid())) {
            return setErrorJson("主鍵不能為空！");
        } else {
            dsgAccountCashService.reconciliation(dsgAccountCash);
            return result(MessageConstants.SSO_STATUS_SUCCESS);

        }
    }

}
